<%@ page import="com.rihel.model.Goods" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/3/15
  Time: 12:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:useBean id="goodsDao" class="com.rihel.dao.GoodsDao"/>
<%
    String goodId = request.getParameter("id") != null ?request.getParameter("id") :request.getParameter("goods_id");
    Goods goods = goodsDao.getGoodsById(Integer.parseInt(goodId));
%>
<%@ include file="includes/head.jsp"%>
<div class="container">
    <div class="row">
        <div class="col-md-4 col-xs-12 col-sm-12">
            <img class="img-thumbnail" src="<%=goods.getPicUrl()%>" alt="">
        </div>
        <div class="col-8">
            <h2>商品名称：<%=goods.getName()%></h2>
            <p>商品id：<%=goods.getId()%></p>
            <p>商品价格:<%=goods.getPrice()%></p>
            <p>商品库存：<%=goods.getNumber()%></p>
            <a  class="btn btn-primary" href="<%="pay.jsp?id="+goods.getId()%>">
                立即购买
            </a>
            <a  class="btn btn-info " href="<%="cart?action=add&redirect=goods.jsp&goods_id="+goods.getId()%>">
                <i class="fa fa-shopping-cart"></i>
                加入购物车
            </a>
        </div>
    </div>
</div>
<%@ include file="includes/foot.jsp"%>